% drawFD.m
% This Matlab script prints results for partial mesh cases after running topo2L.run AMPL script

loadFD;

nmin = 1; nmax = 6; 
nsz = nmax-nmin+1;

values(:,1) = link_f(:,1);
values(:,2) = 100* ones (nsz,1);
values(:,3) = 100* link_f(:,3) ./ link_f(:,2);
values(:,4) = 100* link_f(:,4) ./ link_f(:,2);


figure;
%title ('Comparison of Path Protections using SSR results from Model B');
ylabel ('Percentage of S^{[A]}/S^{[A]}_{FID} for Link Failures (%)');
xlabel ('Network');
axis ([nmin-0.5 nmax+0.5 0 120]);
hold on;
s1 = bar ([values(nmin:nmax,2), zeros(nsz,2)], 'groupable', 'c');
s2 = bar ([zeros(nsz,1), values(nmin:nmax,3), zeros(nsz,1)], 'groupable', 'b');
s3 = bar ([zeros(nsz,2), values(nmin:nmax,4)], 'groupable', 'y');

hold off;
legend ([s1(:,1),s2(:,2),s3(:,3)], ...
   'Failure Independent (FID)','Failure Dependent (FD)','Failure Dependent with Stub Release (FDStubR)',0);
               
values(:,1) = node_f(:,1);
values(:,2) = 100* ones (nsz,1);
values(:,3) = 100* node_f(:,3) ./ node_f(:,2);
values(:,4) = 100* node_f(:,4) ./ node_f(:,2);


figure;
%title ('Comparison of Path Protections using SSR results from Model B');
ylabel ('Percentage of S^{[A]}/S^{[A]}_{FID} for Node Failures (%)');
xlabel ('Network');
axis ([nmin-0.5 nmax+0.5 0 120]);
hold on;
s1 = bar ([values(nmin:nmax,2), zeros(nsz,2)], 'groupable', 'c');
s2 = bar ([zeros(nsz,1), values(nmin:nmax,3), zeros(nsz,1)], 'groupable', 'b');
s3 = bar ([zeros(nsz,2), values(nmin:nmax,4)], 'groupable', 'y');

hold off;
legend ([s1(:,1),s2(:,2),s3(:,3)], ...
   'Failure Independent (FID)','Failure Dependent (FD)','Failure Dependent with Stub Release (FDStubR)',0);
               

